﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Business_Layer;

namespace CaffeBillard
{
    public partial class FormMoveDesk : DevComponents.DotNetBar.Office2007RibbonForm
    {
        public FormMoveDesk()
        {
            InitializeComponent();
        }

        private DeskController desk;
        public int id;
       
        private void FormMoveDesk_Load(object sender, EventArgs e)
        {
            desk= new DeskController();
            var d = desk.FindByStatus(false);
            if (d.Count > 0)
            {
                cbbBan.DataSource = d;
                cbbBan.DisplayMember = "DeskName";
                cbbBan.ValueMember = "Id";
            }
            else
            {
                MessageBox.Show("Hiện tại không có bàn nào trống để chuyển!!! " + cbbBan.Text, "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if(MessageBox.Show("Bạn muốn chuyển bàn hiện tại qua bàn " +cbbBan.Text,"Thông báo",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
            {
                FormWorking.deskid = int.Parse(cbbBan.SelectedValue.ToString());
                this.Close();
            }
        }
    }
}
